package com.demo.autocompletetextviewdemo;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.MultiAutoCompleteTextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        AutoCompleteTextView autotv = findViewById(R.id.autotv);
        MultiAutoCompleteTextView matv = findViewById(R.id.mul_auto_tv);
        String provs[] = getResources().getStringArray(R.array.provinces);
        ArrayAdapter<String> aa = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, provs);
        autotv.setAdapter(aa);
        matv.setAdapter(aa);
        matv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    }
}
